# -*- coding: utf-8 -*-
import scrapy
from movie80s.items import MovieDetail

class Movie80sloadSpider(scrapy.Spider):
    name = 'movie80sload'
    allowed_domains = ['www.prinevillesda.org']
    start_urls = ['https://www.prinevillesda.org/l/1/']

    def parse(self, response):
        currentpPage_movie_item = response.xpath('//li[@class="p1 m1"]')
        for movie_item in currentpPage_movie_item:
            # 创建一个Movie对象
            movie = MovieDetail()
            # 获取电影名称并赋值title属性
            movie['title']=movie_item.xpath('./a/span[@class="lzbz"]/p[@class="name"]').extract()
            # 获取电影的演员、剧情、上映月份及地区信息
            movie['actor']=movie_item.xpath('./a/span[@class="lzbz"]/p[@class="actor"]').extract()
            # 将封装好的一个电影信息添加到容器中,yield作用是创建一个列表并添加元素
            yield movie
            pass
        pass
